#!/usr/bin/env python3

import sys
sys.path.append('../../../tools')
from gmcore_plot import *

fig = plt.figure(figsize=(20, 5))

def plot(data_path, fig):
  f = addfile(data_path)

  ax = fig.add_subplot(121)
  q = f.q1.isel(time=12, lon=180)
  q.plot.contourf(ax=ax, cmap='jet', yincrease=False, vmin=0, vmax=1, extend='both')
  ax.set_title(f'min={q.min().values:.3f}, max={q.max().values:.3f}', fontsize=8)
  ax.tick_params(labelsize=8)
  ax = fig.add_subplot(122)
  q = f.q1.isel(time=24, lon=180)
  q.plot.contourf(ax=ax, cmap='jet', yincrease=False, vmin=0, vmax=1, extend='both')
  ax.set_title(f'min={q.min().values:.3f}, max={q.max().values:.3f}', fontsize=8)
  ax.tick_params(labelsize=8)

plot('adv_dcmip12.360x180x60.h0.nc', fig)

plt.tight_layout()
plt.show()
